<?php
/**
 * 门面模式
 *
 * 给一个类提供另一个类的静态方法
 */

class Module
{
	public  function testModule()
	{
		echo "testModule";
	}
}

interface FacadeInterface{
    public static function getAccess();
}

abstract class Facade implements FacadeInterface
{

	public static function __callStatic($name,$arguments)
	{
		$module = static::getAccess();
		$class_methods = get_class_methods($module);
		if(array_search($name, $class_methods)!==null){
			@call_user_func([$module,$name]);
		}
		
	}
}


class User extends Facade{

	public static function getAccess()
	{
		return 'Module';
	}
}

User::testModule();
